<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="commn/base.css" />
		<link rel="stylesheet" type="text/css" href="css/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/jquery-weui.min.css" />
		<link rel="stylesheet" type="text/css" href="Hui-iconfont/1.0.8/iconfont.css" />
		<style type="text/css">
			body {
				display: -webkit-box;
				-webkit-box-orient: vertical;
				width: 100%;
			}
			
			.index {
				min-width: 240px;
			}
			
			.top {
				display: -webkit-box;
				width: 100%;
				height: 40px;
				background-color: #0F88EB;
			}
			
			.top>span {
				line-height: 40px;
				text-indent: 1em;
				color: white;
				display: -webkit-box;
				font-size: 18px;
				font-weight: bold;
				-webkit-box-flex: 1;
			}
			
			.back {
				color: white;
				font-size: 18px;
				margin-left: 15px;
				line-height: 40px;
			}
			
			.title {
				margin: 10px;
				height: 40px;
				border-bottom: 1px solid #EEEEEE;
			}
			
			.content {
				margin: 10px;
				min-height: 150px;
				border-bottom: 1px solid #EEEEEE;
			}
			.title>input{
				width: 100%;
				height: 100%;
				outline: none;
				border: none;
			}
			.content .ad{
				width: 100%;
				min-height: 150px;
				outline: none;
				word-wrap: break-word;
				white-space: normal;
				word-break: break-all;	
							border: none;
			}
			/*为空时显示 element attribute content*/
			
			/*.title:empty:before,*/
			/*.content:empty:before {*/
				/*content: attr(placeholder);*/
				/* element attribute*/
				/*content: 'this is content';*/
				/*color: #CCCCCC;*/
			/*}*/
			/*焦点时内容为空*/
			
			/*.title:focus:before,*/
			/*.content:focus:before {*/
				/*content: none;*/
			/*}*/
			
			.send {
				height: 40px;
				width: 100px;
				color: white;
				margin-left: 5%;
				font-size: 14px;
				border: 1px solid #0F88EB;
				background-color: #0F88EB;
				outline: none;
				border-radius: 40px;
			}
			
			.offer {
				padding: 10px;
				font-size: 12px;
				color: #9B9B9B;
			}
			
			.offer>input {
				text-align: center;
				outline: none;
				border: none;
				border-bottom: 1px solid #0F88EB;
			}
		</style>
	</head>

	<body>
		<div class="index">
			<div class="top">
				<a href="discovery.html" class="back Hui-iconfont Hui-iconfont-slider-left"></a>
				<span>提问</span>
			</div>
			<div class="home_content">
				<p class="title"><input type="text" name="" id="" placeholder="请输入标题" v-model="title"/> </p>
				<p class="content"><textarea class="ad" placeholder="添加描述...." v-model="content"></textarea></p>
				<p class="offer">输入悬赏金额：<input type="text" class="money" v-model="money"></p>
				<p class="offer">输入问题分类：<input type="text" class="fenli" v-model="fenlei"></p>
				<p><input type="button" class="send" value="提交问题" @click="song()"/></p>
			</div>
		</div>
		<script src="js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			new Vue({ 
				el: "body",
				data: {
					title:"",
					content:"",
					money:"",
					fenlei:""
				},
				methods: {
					song:function(){
						send(this.title,this.content,this.money,this.fenlei);
					}
				}
			});
			
			var year = new Date();
			var nian = year.getFullYear();
			var yue = (year.getMonth()+1)<10?"0"+(year.getMonth()+1):year.getMonth()+1 ;
			var day = year.getDate()<10?"0"+year.getDate():year.getDate(); 
			var str1 = nian + "-" + yue + "-" + day;
			function send(title,content,money,fenlei) {
				var ss;
				var dd;
				$.ajax({
					type: 'get',
					//async:false,
					url: "http://v2.mashupcloud.cn/developer/auth.do",
					data: {
						appkey: 'FvWrIYOQoTUYVbscUNQoQAVqsLnZqKEN',
						appsecret: 'ugCfcSmyLkcbCGfIuFOPEgTgPQPbyJSE'

					},
					success: function(json) {
						//		            console.log(json);
						ss = JSON.parse(json)[1];
						dd = JSON.parse(json)[2];
						console.log('获得token成功');
						$.ajax({
							type: 'get',
							url: "http://v2.mashupcloud.cn/SQL/into_tie/",
							data: {
								appid: dd,
								token: ss,
								name: 'into_tie',
								_v1: title,
								_v2: content,
								_v3: "5",
								_v4: str1,
								_v5: money,
								_v6: fenlei

							},
							success: function(json) {
								console.log(JSON.parse(json));
								alert("提问成功");
								location.href = "discovery.html"
							},
							error: function(json) {
								console.log("err:" + json);
							}
						});
					},
					error: function(json) {
						console.log("err:" + json);
					}
				});

			};
		</script>
	</body>

</html>